package com.egdd.video.service.iml;

import com.egdd.video.mapper.VideoMapper;
import com.egdd.video.pojo.Video;
import com.egdd.video.service.IVideoService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VideoServiceImpl implements IVideoService {

    @Autowired(required = false)
    VideoMapper videoMapper;

    @Override
    public List<Video> getVideoByAlbumId(Integer albumId, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        //之后进行查询操作将自动进行分页
        List<Video> videoList = videoMapper.getVideoByAlbumId(albumId);
        return videoList;
    }



    @Override
    public int delVideoById(int id) {
        int count = videoMapper.deleteByPrimaryKey(id);
        return count;
    }

    @Override
    public int uploadVideo(Video video) {
        int count = videoMapper.insert(video);
        return count;
    }
}
